template(name="listHeader")
  .list-header.js-list-header.nodragscroll(
    class="{{#if limitToShowCardsCount}}list-header-card-count{{/if}}"
    class=colorClass)
    +inlinedForm
      +editListTitleForm
    else
      if isMiniScreen
        if currentList
          a.list-header-left-icon.fa.fa-angle-left.js-unselect-list
      else
        if collapsed
          a.js-collapse(title="{{_ 'uncollapse'}}")
            i.fa.fa-arrow-left.list-header-uncollapse-left
            i.fa.fa-arrow-right.list-header-uncollapse-right
          if showCardsCountForList cards.length
            br
            span.cardCount {{cardsCount}}
      if isMiniScreen
        h2.list-header-name(
          title="{{ moment modifiedAt 'LLL' }}"
          class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}{{#unless currentUser.isWorker}}js-open-inlined-form is-editable{{/unless}}{{/unless}}{{/if}}")
          +viewer
            = title
          if wipLimit.enabled
           |&nbsp;(
           span(class="{{#if exceededWipLimit}}highlight{{/if}}") {{cards.length}}
           |/#{wipLimit.value})
        if showCardsCountForList cards.length
          span.cardCount {{cardsCount}} {{cardsCountForListIsOne cards.length}}
      else
        div(class="{{#if collapsed}}list-rotated{{/if}}")
          h2.list-header-name(
            title="{{ moment modifiedAt 'LLL' }}"
            class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}{{#unless currentUser.isWorker}}js-open-inlined-form is-editable{{/unless}}{{/unless}}{{/if}}")
            +viewer
              = title
            if wipLimit.enabled
             |&nbsp;(
             span(class="{{#if exceededWipLimit}}highlight{{/if}}") {{cards.length}}
             |/#{wipLimit.value})
        unless collapsed
          if showCardsCountForList cards.length
            span.cardCount {{cardsCount}} {{cardsCountForListIsOne cards.length}}
      if isMiniScreen
        if currentList
          if isWatching
            i.list-header-watch-icon.fa.fa-eye
          div.list-header-menu
            unless currentUser.isCommentOnly
              if canSeeAddCard
                a.js-add-card.fa.fa-plus.list-header-plus-top(title="{{_ 'add-card-to-top-of-list'}}")
              a.fa.fa-navicon.js-open-list-menu(title="{{_ 'listActionPopup-title'}}")
        else
          a.list-header-menu-icon.fa.fa-angle-right.js-select-list
          a.list-header-handle.handle.fa.fa-arrows.js-list-handle
      else if currentUser.isBoardMember
        if isWatching
          i.list-header-watch-icon.fa.fa-eye
        unless collapsed
          div.list-header-menu
            unless currentUser.isCommentOnly
              //if isBoardAdmin
              //  a.fa.js-list-star.list-header-plus-top(class="fa-star{{#unless starred}}-o{{/unless}}")
              if canSeeAddCard
                a.js-add-card.fa.fa-plus.list-header-plus-top(title="{{_ 'add-card-to-top-of-list'}}")
                a.js-collapse(title="{{_ 'collapse'}}")
                  i.fa.fa-arrow-right.list-header-collapse-right
                  i.fa.fa-arrow-left.list-header-collapse-left
                a.fa.fa-navicon.js-open-list-menu(title="{{_ 'listActionPopup-title'}}")
            if currentUser.isBoardAdmin
              if isTouchScreenOrShowDesktopDragHandles
                a.list-header-handle.handle.fa.fa-arrows.js-list-handle

template(name="editListTitleForm")
  .list-composer
    input.list-name-input.full-line(type="text" value=title autofocus)
    .edit-controls.clearfix
      button.primary.confirm(type="submit") {{_ 'save'}}
      a.fa.fa-times-thin.js-close-inlined-form

template(name="listActionPopup")
  ul.pop-over-list
    li
      a.js-add-card.list-header-plus-bottom
        i.fa.fa-plus
        i.fa.fa-arrow-down
        | {{_ 'add-card-to-bottom-of-list'}}
  hr
  ul.pop-over-list
    li
      a.js-set-list-width
        i.fa.fa-arrows-h
        |  {{_ 'set-list-width'}}
  ul.pop-over-list
    li
      a.js-toggle-watch-list
        if isWatching
          i.fa.fa-eye
          |  {{_ 'unwatch'}}
        else
          i.fa.fa-eye-slash
          |  {{_ 'watch'}}
  unless currentUser.isCommentOnly
    unless currentUser.isWorker
      ul.pop-over-list
        li
          a.js-set-color-list
            i.fa.fa-paint-brush
            | {{_ 'set-color-list'}}
    ul.pop-over-list
      if cards.length
        li
          a.js-select-cards
            i.fa.fa-check-square
            | {{_ 'list-select-cards'}}
    if currentUser.isBoardAdmin
      ul.pop-over-list
        li
          a.js-set-wip-limit
            i.fa.fa-ban
            | {{#if isWipLimitEnabled }}{{_ 'edit-wip-limit'}}{{else}}{{_ 'setWipLimitPopup-title'}}{{/if}}
    unless currentUser.isWorker
      hr
      ul.pop-over-list
        li
          a.js-close-list
            i.fa.fa-arrow-right
            i.fa.fa-archive
            | {{_ 'archive-list'}}
    hr
    ul.pop-over-list
      li
        a.js-more
          i.fa.fa-link
          | {{_ 'listMorePopup-title'}}

template(name="boardLists")
  ul.pop-over-list
    each currentBoard.lists
      li
        if($eq ../_id _id)
          a.disabled {{title}} ({{_ 'current'}})
        else
          a.js-select-list= title

template(name="listMorePopup")
  p.quiet
    span.clearfix
      span {{_ 'link-list'}}
      = ' '
      i.fa.colorful(class="{{#if board.isPublic}}fa-globe{{else}}fa-lock{{/if}}")
      input.inline-input(type="text" readonly value="{{ rootUrl }}")
    | {{_ 'added'}}
    span.date(title=list.createdAt) {{ moment createdAt 'LLL' }}
    //unless currentUser.isWorker
    //  if currentUser.isBoardAdmin
    //    a.js-delete {{_ 'delete'}}

template(name="listDeletePopup")
  p {{_ "list-delete-pop"}}
  unless archived
   p {{_ "list-delete-suggest-archive"}}
  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}

template(name="setWipLimitPopup")
  #js-wip-limit-edit
    label {{_ 'set-wip-limit-value'}}
    ul.pop-over-list
      li: a.js-enable-wip-limit {{_ 'enable-wip-limit'}}
        if isWipLimitEnabled
          i.fa.fa-check
    if isWipLimitEnabled
      p
        input.wip-limit-value(type="number" value="{{ wipLimitValue }}" min="1" max="99")
        input.wip-limit-apply(type="submit" value="{{_ 'apply'}}")
        input.wip-limit-error
      p
        .soft-wip-limit
          .materialCheckBox(class="{{#if isWipLimitSoft}}is-checked{{/if}}")
        label {{_ 'soft-wip-limit'}}

template(name="wipLimitErrorPopup")
  .wip-limit-invalid
    p {{_ 'wipLimitErrorPopup-dialog-pt1'}}
    p {{_ 'wipLimitErrorPopup-dialog-pt2'}}
    button.full.js-back-view(type="submit") {{_ 'cancel'}}

template(name="setListWidthPopup")
  #js-list-width-edit
    label {{_ 'set-list-width-value'}}
      p
        input.list-width-value(type="number" value="{{ listWidthValue }}" min="100")
        input.list-width-apply(type="submit" value="{{_ 'apply'}}")
        input.list-width-error

template(name="listWidthErrorPopup")
  .list-width-invalid
    p {{_ 'list-width-error-message'}} '&gt;=100'
    button.full.js-back-view(type="submit") {{_ 'cancel'}}

template(name="setListColorPopup")
  form.edit-label
    .palette-colors: each colors
      // note: we use the swimlane palette to have more than just the border
      span.card-label.palette-color.js-palette-color(class="card-details-{{color}}")
        if(isSelected color)
          i.fa.fa-check
    button.primary.confirm.js-submit {{_ 'save'}}
    button.js-remove-color.negate.wide.right {{_ 'unset-color'}}
